package nowcoder;
/**
 * 洗牌
 */
import java.util.*;
public class Day21_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int t = input.nextInt(); // 数据组数
        List<int[]> list = new ArrayList<>();

        for (int i = 0; i < t; i++) {
            int n = input.nextInt();
            int k = input.nextInt();
            int[] nums = new int[2 * n];
            for (int j = 0; j < nums.length; j++) {
                nums[j] = input.nextInt();
            }

            //添加洗牌后的结果
            list.add(xipai(nums, k));
        }

        // 输出
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < list.get(i).length; j++) {
                System.out.print(list.get(i)[j] + " ");
            }
            System.out.println();
        }
    }

    // k次洗牌
    private static int[] xipai(int[] nums, int k) {
        int[] tmp = new int[nums.length];
        for (int i = 0; i < k; i++) {
            // tmp为经过一次洗牌后的结果
            for (int j = 0; j < tmp.length; j++) {
                // 原下标 0 1 2 3 4 5
                // 排序后 0 3 1 4 2 5
                if(j % 2 == 0){
                    tmp[j] = nums[j / 2];
                }else{
                    tmp[j] = nums[(j-1)/2 + nums.length/2];
                }
            }
            nums = Arrays.copyOf(tmp, tmp.length);
        }
        return nums;
    }
}
